﻿from kmp import kmp_matcher
import unittest

class kmp_unittest(unittest.TestCase):
    def test_matcher_1(self):
        T, P = 'ccabcababcabc', 'cab'
        self.assertEqual([1,4,9], kmp_matcher(T, P))

    def test_matcher_negative(self):
        T, P = 'ccabcababcabc', 'xxx'
        self.assertEqual([], kmp_matcher(T, P))

suite = unittest.TestLoader().loadTestsFromTestCase(kmp_unittest)
unittest.TextTestRunner(verbosity=2).run(suite)

if __name__ == '__main__':
    unittest.main()
